//作业作业作业作业作业作业作业作业作业作业作业作业作业
//作业作业作业作业作业作业作业作业作业作业作业作业作业
package oracle;
import version.Mysql;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class Oracle {
    private static String url;
    private static String username;
    private static String password;

    public static void getParam(String fileName) throws IOException {
        Properties p=new Properties();
        InputStream fis=
                Oracle.class.getClassLoader().getResourceAsStream(fileName);
        p.load(fis);
        url=p.getProperty("url");
        username=p.getProperty("username");
        password=p.getProperty("password");
        System.out.println("Oracle数据库基本信息"+url+username+password);
    }
    public static void main(String[] args) throws IOException, SQLException {
        Oracle.getParam("db_oracle.properties");

        //这里不会，报错显示url错误，不知道为何
        Connection con = DriverManager.getConnection(url, username, password);
        //执行sql 创建成功数据库
        String st="insert into book values(7,'蔡坤','你太美',175,'的2018',55,'是')";
        Statement stt=con.createStatement();
        //增删改 executeUpdate() 返回几条
        int rows=stt.executeUpdate(st);
        System.out.println(rows);
    }
}















